//
//  KZRecordingView.m
//  听说弱点强化训练
//
//  Created by 朱凯 on 2018/10/22.
//  Copyright © 2018年 盛超. All rights reserved.
//

#import "KZRecordingView.h"

#import "KZWaveView.h"  // 水波纹

@implementation KZRecordingView
{
    KZWaveView *_waveView;
}

- (instancetype)init {
    if (self = [super init]) {
    
        [self setupUI];
    }
    return self;
}
- (void)setupUI {
    
    UIImageView *mkfView = [[UIImageView alloc] init];
    mkfView.image = [UIImage imageNamed:@"kz-麦克风"];
    [self addSubview:mkfView];
    [mkfView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self);
    }];
}
- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    if (!_waveView) {
        _waveView = [[KZWaveView alloc] initWithFrame:self.bounds];
        _waveView.firstWaveColor = [KZThemeColor colorWithAlphaComponent:0.4];
        _waveView.secondWaveColor = UIColor.clearColor;
        _waveView.waveSpeed = 0.5/M_PI;
        _waveView.waveAmplitude = 2;
        _waveView.waveAmplitudeDynamic = false;
        _waveView.percent = 0;
        [self addSubview:_waveView];
        [_waveView startWave];
    }
    

}
- (void)setPercent:(CGFloat)percent {
    
    _percent = percent;
    _waveView.percent = percent;
}

@end
